<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <title>我的关注</title>
    <link rel="stylesheet" href="<%=path%>/web/userinfo/css/attention.css">
    <link rel="stylesheet" href="<%=path%>/web/userinfo/css/page.css">
</head>
<body>
<div class="make_head_title">我的关注</div>
<br>
<ul class="favorite transform-style">

</ul>
<script src="<%=path %>/web/static/js/modules/jquery-3.4.1.min.js"></script>
<script src="<%=path %>/web/static/layui/layui.all.js"></script>
</body>
</html>
<script>
    $(function () {
        initData(1);

        $(".favorite").on("click", ".meneame a", function () { //给页码加点击事件
            var pageNum = $(this).data("id");
            initData(pageNum);
            return false;
        })


        $(".favorite").on("click", "li .close-favorite", function () { //取消关注
            var informationId = $(this).data("id");

            layer.confirm("确认要取消关注吗", { title: "取关确认",btn: ['确认', '取消'] }, function (index) {
                    layer.close(index);
                    $.get("${pageContext.request.contextPath}/web/userinfo/deleteAttentionById",{informationId:informationId},function () {
                        initData(1);
                        layer.msg('取关成功', {icon: 5});
                    })
                });
            });
    })

    function initData(pageNum) {   //页码
        var pageNum = {pageNum: pageNum};
        $.get("${pageContext.request.contextPath}/web/userinfo/attentionList", pageNum, function (mes) {
                $(".favorite").empty();
                $(".favorite").html(mes);
            }
        );
    }

</script>